// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_c;

import java.util.Enumeration;
import java.util.Hashtable;

// Referenced classes of package com.nnee.c:
//            g, b

public class cls_c
{

    public cls_c()
    {
    }

    private static int a(char ac[], int i, char c1)
    {
while(true)
{
        if(i >= ac.length)
        {
        	i = -1;
        	return i;
        }
        if(ac[i] != c1) {
        	i = -1;
        } else return i;
}

    }

    private static int a(char ac[], int i, String s)
    {
    	 boolean flag = false;
    	int j = 0;
        char ac1[] = s.toCharArray();
while(true)
{
        if(i >= ac.length - ac1.length) {
        	i = -1;
        	return i;
        }else {
        	if(j >= ac1.length)
                {
        		i = -1;
        		return i;
                }
            if(ac[i + j] == ac1[j]) {
            	flag = true;
            	return i;
            }else {
            	flag = false;
            }
            
            j++;
        }
}
 
    }

    private static cls_g a(char ac[], int i, boolean flag)
    {
        cls_g g1;
        if(i >= ac.length)
            g1 = null;
        else
        if(ac[i] == '<')
        {
            int k = a(ac, i + 1, '>');
            if(k == -1)
            {
                g1 = new cls_g(0, ac, i, ac.length, flag);
            } else
            {
                String s = new String(ac, i, 1 + (k - i));
                if(s.startsWith("<!--"))
                {
                    int j1 = a(ac, i + 1, "-->");
                    if(j1 == -1)
                        g1 = new cls_g(1, ac, i, ac.length, flag);
                    else
                        g1 = new cls_g(1, ac, i, j1 + 3, flag);
                } else
                {
                    String s1 = s.toLowerCase();
                    if(s1.startsWith("<style"))
                    {
                        int i1 = a(ac, i + 1, "</style>");
                        if(i1 == -1)
                            g1 = new cls_g(4, ac, i, ac.length, flag);
                        else
                            g1 = new cls_g(4, ac, i, i1 + 9, flag);
                    } else
                    if(s1.startsWith("<script"))
                    {
                        int l = a(ac, i + 1, "</script>");
                        if(l == -1)
                            g1 = new cls_g(3, ac, i, ac.length, flag);
                        else
                            g1 = new cls_g(3, ac, i, l + 9, flag);
                    } else
                    {
                        g1 = new cls_g(2, ac, i, i + s.length(), flag);
                    }
                }
            }
        } else
        {
            int j = a(ac, i + 1, '<');
            if(j == -1)
                g1 = new cls_g(0, ac, i, ac.length, flag);
            else
                g1 = new cls_g(0, ac, i, j, flag);
        }
        return g1;
    }

    public static String a(String s)
    {
        StringBuffer stringbuffer = new StringBuffer(s.length());
        char ac[] = s.toCharArray();
        int i = 0;
        StringBuffer stringbuffer1 = stringbuffer;
        boolean flag = false;
        do
        {
            cls_g g1 = a(ac, i, flag);
            if(g1 == null)
                return stringbuffer1.toString();
            flag = g1.b();
            stringbuffer1.append(g1.c());
            if(g1.toString().startsWith("</p") || g1.toString().startsWith("</br") || g1.toString().startsWith("</div"))
                stringbuffer1 = stringbuffer1.append("\n");
            i += g1.a();
        } while(true);
    }

    public static String b(String s)
    {
        Enumeration enumeration = a.keys();
        do
        {

            {
                if(!enumeration.hasMoreElements())
                    break ;
                String s1 = (String)enumeration.nextElement();
                s = com.nnee.p_c.cls_b.a(s, s1, (String)a.get(s1));
                do
                {
                    int i = s.indexOf(s1);
                    if(i == -1)
                        break;
                    s = (new StringBuilder()).append(s.substring(0, i)).append(a.get(s1)).append(s.substring(i + s1.length())).toString();
                } while(true);
            }
        } while(true);
        return s;
    }

    public static final Hashtable a;

    static 
    {
        a = new Hashtable();
        a.put("&lt;", "<");
        a.put("&gt;", ">");
        a.put("&amp;", "&");
        a.put("&ldquo;", "\"");
        a.put("&rdquo;", "\"");
        a.put("&quot;", "\"");
        a.put("&nbsp;", " ");
        a.put("&emsp;", " ");
        a.put("&ensp;", " ");
        a.put("&times;", "\327");
        a.put("&divide;", "\367");
        a.put("&copy;", "??");
        a.put("&reg;", "??");
        a.put("??", "??");
    }
}
